import { createRouter, createWebHistory, } from 'vue-router'
import HomeView from '../views/HomeView.vue'
import Login from "@/views/Login.vue"

const router = createRouter({
  history:createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: '登录页面',
      component: Login,
    },{
      path: '/',
      name: 'home',
      redirect: '/index',
      component: HomeView,
      meta:{
        requiresAuth: true
      },
      children:[
        {
          path:'/index',
          name: '首页',
          component: () => import('../views/Index.vue'),
        },
        {
          path:'/user',
          name: '用户管理',
          component: () => import('../views/SysManagement/User/index.vue'),
        },
        {
          path:'/role',
          name: '角色管理',
          component: () => import('../views/SysManagement/Role/index.vue'),
        },
        {
          path:'/dept',
          name: '部门管理',
          component: () => import('../views/SysManagement/Dept/index.vue'),
        },
        {
          path:'/menu',
          name: '菜单管理',
          component: () => import('../views/SysManagement/Menu/index.vue'),
        },{
          path:'/area',
          name: '地区管理',
          component: () => import('../views/Basic/Area/index.vue'),
        },{
          path:'/community',
          name: '小区管理',
          component: () => import('../views/Basic/Community/index.vue'),
        },{
          path:'/house',
          name: '房屋管理',
          component: () => import('../views/Basic/House/index.vue'),
        },{
          path:'/resident',
          name: '住户管理',
          component: () => import('../views/Basic/Resident/index.vue'),
        },{
          path:'/resident/edit',
          name: '编辑住户',
          component: () => import('@/views/Basic/Resident/view/Edit.vue')
        }
      ]
    },
  ],
})


export default router
